// 文章分类列表
const express = require('express')

const router = express.Router()


const artcate_handler = require('../router_handler/artcate')

// 获取文章分类的总列表
router.get('/cates',artcate_handler.getArticleCates)


// 导入验证数据合法性的中间件
const expressJoi = require('@escook/express-joi')
const { add_cate_schema,delete_cate_schema,update_cate_schema }  =require('../schema/artcate')

// 新增文章分类的路由
router.post('/addcates',expressJoi(add_cate_schema), artcate_handler.addArticleCates)

// 删除文章分类
router.get('/deletecate/:id',expressJoi(delete_cate_schema), artcate_handler.deleteCateById)

// 获取单个的文章

router.get('/cates/:id',expressJoi(delete_cate_schema),artcate_handler.getArticleById)

// 更新文章分类的路由
router.post('/updatecate',expressJoi(update_cate_schema), artcate_handler.updateCateById)

module.exports = router
